#!/bin/sh

rm -rf cloudteach/

#rm -rf ./wget-log/cloudteach

#wget http://logs.neiwang.com/192.168.8.20/logback/ -m -r -np -A *2015-09-14*.log -R *.html,*.gif -c -b -o ./wget-log/wget-20.log && tail -f wget-log/wget-20.log

ldate=$1

if [ ! $ldate ]; then
	echo "IS NULL"
	ldate=$(date +%Y-%m-%d)

	echo "正在下载，日志日期为："
	echo $ldate

	#mkdir -p wget/cloudteach

	wget http://logs.neiwang.com/192.168.8.18/logback/ -m -r -np -A *$ldate*.log -R *.html,*.gif -c -P cloudteach/

	wget http://logs.neiwang.com/192.168.8.19/logback/ -m -r -np -A *$ldate*.log -R *.html,*.gif -c -P cloudteach/

	wget http://logs.neiwang.com/192.168.8.20/logback/ -m -r -np -A *$ldate*.log -R *.html,*.gif -c -P cloudteach/

	#下载当前未截断的log
	wget http://logs.neiwang.com/192.168.8.18/logback/service/cloudteach-service.log -m -r -np -R *.html,*.gif -c -P cloudteach/

	wget http://logs.neiwang.com/192.168.8.19/logback/service/cloudteach-service.log -m -r -np -R *.html,*.gif -c -P cloudteach/

	wget http://logs.neiwang.com/192.168.8.20/logback/service/cloudteach-service.log -m -r -np -R *.html,*.gif -c -P cloudteach/

	wget http://logs.neiwang.com/192.168.8.18/logback/web/cloudteach-web.log -m -r -np -R *.html,*.gif -c -P cloudteach/

	wget http://logs.neiwang.com/192.168.8.19/logback/web/cloudteach-web.log -m -r -np -R *.html,*.gif -c -P cloudteach/

	wget http://logs.neiwang.com/192.168.8.20/logback/web/cloudteach-web.log -m -r -np -R *.html,*.gif -c -P cloudteach/


	echo "下载结束"

else
	echo "NOT NULL"

	echo "正在下载，日志日期为："
	echo $ldate

	mkdir -p wget/cloudteach

	wget http://logs.neiwang.com/192.168.8.18/logback/ -m -r -np -A *$ldate*.log -R *.html,*.gif -c -P cloudteach/

	wget http://logs.neiwang.com/192.168.8.19/logback/ -m -r -np -A *$ldate*.log -R *.html,*.gif -c -P cloudteach/

	wget http://logs.neiwang.com/192.168.8.20/logback/ -m -r -np -A *$ldate*.log -R *.html,*.gif -c -P cloudteach/

	echo "下载结束"

fi



